<!DOCTYPE html>

<head>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <!-- import Vue before Element -->
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
  <!-- import element-ui JavaScript -->
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <div id="app">
    <div> {{n}}</div>
    <button @click="stop"> alert</button>
  </div>
</head>

<script>
  var demo = new Vue({
    el: "#app",
    data() {
      return {
        n: 0
      };
    },
    computed: {},
    mounted() {
      this.setNum()
    },

    methods: {
      stop() {
        let s = new Date().getTime()
        while (new Date().getTime() - s < 6000) {
          this.n = new Date().getTime()
        }
      },
      setNum() {
        this.n++
        setTimeout(() => { this.setNum() }, 800)
      }
    }
  });
</script>